//
//  LBPathFinder.h
//  LittleBall
//
//  Created by yy on 11-11-27.
//  Copyright (c) 2011年 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LBPosition.h"
#import "LBPathFind.h"
#import "LittleBallGameManagement.h"


enum MAP_POSITION_STATE
{
    POSITION_EMPTY = 0,
    POSITION_PATH = 1,
    POSITION_BALL = 2
};

enum MAP_TYPE 
{
    MAP_SOURCE = 0,
    MAP_PATH = 1
};


@interface LBPathFinder : LBPathFind
{    
    enum MAP_POSITION_STATE m_sourceMap[MAX_ROW+1][MAX_COLUMN+1];
    enum MAP_POSITION_STATE m_pathMap[MAX_ROW+1][MAX_COLUMN+1];
    
    NSMutableArray  *m_parthPoints;
    LBPosition     *m_startPosition;
    LBPosition     *m_endPosition;
    
    NSMutableArray *m_positionsArray; // 用于返回getPositionsWithNum的结果
}

+(CGPoint)translatePositionToCenterPointFromRow:(int)row column:(int)column;

// 不仅仅是centerpoint，而是任意touchpoint到行、列号的映射
+(BOOL)tranllateTouchPointToPositionFromPoint:(CGPoint)touchPoint toRow:(int *)pRow toColumn:(int *)pColumn;

-(id)init;
-(BOOL)findPathFromStartPosition:(LBPosition*)startPosition toEndPosition:(LBPosition*)endPositon;

-(BOOL)setPositionStateToMapWithType:(enum MAP_TYPE)mapType atPosition:(LBPosition*)position toState:(enum MAP_POSITION_STATE)positionState;

-(NSMutableArray *)getPositionsWithNum:(int)num withState:(enum MAP_POSITION_STATE)positionState;

@property (retain) NSMutableArray *m_parthPoints;
@property (retain) LBPosition *m_endPosition;

@end